<?php
namespace app\home\validate;
use think\Validate;

class UserCheck extends Validate
{
    protected $rule = [
        'username'       => 'require',
        'password'       => 'require',
        'pwd'            =>'require|min:6|confirm',
        'captcha'        => 'require|captcha',
    ];

    protected $message = [
        'username.require'       => '账号不能为空',
        'password.require'       => '密码不能为空',        
        'pwd.require'            => '密码不能为空',
        'pwd.min'                => '密码必须6位以上',
        'pwd.confirm'            => '两次密码不一致',//confirm自动相互验证
        'captcha.require'        => '验证码不能为空',
        'captcha.captcha'        => '验证码不正确',
    ];

    protected $scene = [
        'login'       => ['username', 'password','captcha'],
        'reg'         => ['username', 'pwd','captcha']
    ];

}